<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>会员添加</title>
    <link rel="stylesheet" href="jquery.mobile-1.4.5.min.css">
    <script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
    <script src="jquery.mobile-1.4.5.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            $('#cx').click(function(){
                var userName = $('#userName').val();
                var url = "http://www.ssports.com/activity_api/giftBag/membership/" + userName;
                $.ajax({
                    type:"GET",
                    url: url,
                    contentType:"text/plain",
                    dataType: 'jsonp',
                    jsonpCallback: "callback",
                    success: function(data){
                        var code = data.retData.code;
                        if (code == 'D000') {
                            var message = "";
                            $.each(data.retData.data, function (n,value) {
                                if (n != 0) {
                                    $.each(value, function (m,value2) {
                                        message += "Key:" + m + ", Value:" + value2 + "</br>";
                                    });
                                }
                            });
                            $('#area').html(message);
                        } else {
                            alert("找不到此用户");
                        }
                    }
                });
            });
        });
    </script>
</head>
<body>
<h3 class="ui-bar ui-bar-a ui-corner-all">Heading</h3>
<div class="ui-body ui-body-a ui-corner-all">
    <p>put your mobile phone number into input form</p>
</div>
<label for="userName">Text input:</label>
<input type="text" name="text-basic" value="" id="userName">
<button class="ui-shadow ui-btn ui-corner-all" id="cx">Button element</button>
<div id="area">
   
</div>
</div>

</body>
</html>